package com.drink.yan.intf.define;

import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * java类简单作用描述
 *
 * @Title:
 * @Package: com.drink.yan.intf.define.
 * @Author: M.simple
 * @Remark: The modified content
 * @CreateDate: 2023-12-09 13:53
 * @Version: v2.0
 */
public enum YanOrderStatusE {

	created("created", "已下单"),
	paid("paid", "已支付"),
	delivered("delivered", "已发货"),
	received("received", "已收货"),
	completed("completed", "已完成"),
	cancelled("cancelled", "已取消"),
	;

	private String code;

	private String remark;

	YanOrderStatusE(String code, String remark) {
		this.code = code;
		this.remark = remark;
	}

	public String getCode() {
		return code;
	}

	public String getRemark() {
		return remark;
	}

	public static String code(String code){
		List<YanOrderStatusE> collect = Arrays.stream(YanOrderStatusE.values()).filter(x -> x.getCode().equals(code)).collect(Collectors.toList());
		if(CollectionUtils.isEmpty(collect)){
			return "";
		}
		return collect.get(0).getRemark();
	}
}
